// console.log(111);
interface objType{
     name:string,
     age:number
}

let obj:objType={
    name:'张三',
    age:23
}


function objFun(obj:objType){
 console.log(obj);
}
objFun(obj)




let arr:number[]=[1,1,2,4,5,2,5,2,8,5]
const Funm = (arr:number[]):number[] => {
    let newArr:number[]=[]
    arr.forEach((item,index)=>{
        if(newArr.indexOf(item)==-1){
            newArr.push(item)
        }
    })
    return newArr
}

console.log(Funm(arr));



//数字（乘5）添加：
//将arrs中所有的数字乘以5 var arrs = [‘a’,’c’,6,’e’,5,3,’d’]，返回[30,25,15]


let newAdd:any=['a','c','s',5,'f',4,6]
const FunAdd=(newAdd:any[])=>{
     let newAcc:any=[]
     newAdd.forEach((item,index)=>{
       if(typeof item==='number'){
         newAcc.push(item*5)
       }
     })
     return newAcc
}
console.log(FunAdd(newAdd));

// Ts定义一个求和函数;例Add(2,8,9,6,5,8,7),返回结果45
let sum:any=[5,5,5]
const Fsum=(sum:any)=>{
   let s =0;
   for(let i = 0; i < sum.length; i++){
       s+=sum[i]
   }
   return s
}
console.log(Fsum(sum));


// Ts定义一个函数返回值为boolean类型的判断函数;例isTrue(nudefined),返回false
let isTrue:any=true
const FnisTrue=(isTrue:any)=>{
    if(typeof isTrue==='boolean'){
        return false
    }else{
        return true
    }
}
console.log(FnisTrue(isTrue));


let isSting:string='aaacccrrc'
const FnSting=(isSting:string)=>{
    let Word:any=0
    isSting.split('').forEach((item,index)=>{
        
    })
}






